<link rel="stylesheet" href="<?php echo STATIC_URL.'backend/css/notice.css'?>" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script>
function closeFancy(){
    parent.jQuery.fancybox.close();
}
function sendAjax(){
    var deletebk = $("#deletebk").val();
    if(deletebk == ""){
        alert("Vui lòng nhập thông tin");$("#deletebk").focus();return false;
    }
    
    $("#submit").attr('disabled','disabled');
    $("#cancel").attr('disabled','disabled');
    $("#success").html("<img src='<?php echo STATIC_URL;?>/backend/images/icon/loading-2.gif' /> <br/> Vui lòng chờ");
    
    setTimeout(function () {
        $.ajax(
            {
                url : '/auth/bookingStatus/delete',
                type: "POST",
                data : { deletebk:deletebk,id:$("#id").val(),session:$("#session").val()},
                cache: true,
                beforeSend: function(){
                        $("#success").html("<img src='<?php echo STATIC_URL;?>/backend/images/icon/loading-2.gif' /> <br/> Đang xử lí");
                },
                success:function(data)
                {
                    setTimeout(function () {
                        
                        if(data==0){
                            $("#success").html("<?php echo $this->lang->line("delete_successful");?>");
                            setTimeout(function () {
                                window.top.location.href="/auth/bookingStatus/";
                            },2000);
                            
                        } else {
                            $("#submit").removeAttr('disabled');
                            $("#cancel").removeAttr('disabled');
                            $("#success").html("<?php echo $this->lang->line("error");?>");
                        }
                    },2000);
                },
                error: function() 
                {
                    $("#success").html("Thao tác thất bại!");
                }
            });
     },2000);
    
    
}
</script>
<div id="container2">
    <h3 id="nav2" class="logo">
        <a id="logo">&nbsp;</a>
    </h3>
    <?php 
    if(isset($payment_confirm) && $payment_confirm == 1){
        $payment_info           =   "Đã thanh toán";
    } else {
        $payment_info           =   "Chưa thanh toán";
    }
    ?>
    <div id="wufoo-mz9i3ib0wkzqls">
        <ul style="text-align: center;">
            <li style="font-weight: bold;font-size: 18px;">VUI LÒNG NHẬP LÍ DO XÓA BOOKING</li>
            <li><br/><?php echo form_textarea(array('name' => 'deletebk', 'id' => 'deletebk', 'value' => '','placeholder'=>'Vui lòng nhập lí do xóa','required'=>'required','rows'=>'5','cols'=>'60'));?></li>
            <li><?php if(isset($voucher_id) && $voucher_id){echo "Bookig này nằm trong chứng từ số ".$voucher_id." ".$payment_info."! Việc xóa booking sẽ xóa luôn chứng từ! Hành động này ko thể Undo!<br/>";}?></li>
        </ul>

        <div class="top-button">
            <?php echo form_button(array('id' => 'submit', 'name' => 'submit', 'content' => $this->lang->line('continue'),'class' => 'btn btn-primary','onclick'=>'sendAjax()')); ?>
            <?php echo form_button(array('id' => 'cancel','content' => $this->lang->line('close'),'class' => 'btn','onclick'=>'closeFancy()')); ?>
        </div>
        <?php echo form_input(array('type'=>'hidden', 'name' => 'id', 'id' => 'id', 'value' => $id));?>
        <?php echo form_input(array('type'=>'hidden', 'name' => 'id', 'id' => 'session', 'value' => ($session)?$session:''));?>
        <div id="success"></div>
    </div>
</div>